
package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/hello")
public class HelloWorldController {

    @RequestMapping("/index")
    public ModelAndView helloWord() {
        ModelAndView view = new ModelAndView("helloWorld");
        view.addObject("message", "Hello");
        return view;
    }

    @RequestMapping("/test")
    @ResponseBody
    public String test() {
        return "test";
    }
}